<?php
	//$img：图片地址
	//Filetype: JPEG,PNG,GIF 
	$Img = $_FILES['file']['name'];
	$base64_img = Base64EncodeImage($Img);
	// echo base64_decode($base64_img);
	// echo $base64_img;
	echo '<img src="' . $base64_img . '" />';
	function Base64EncodeImage ($ImageFile) {
	  $base64_image = '';
	  $image_info = getimagesize($image_file);
	  $image_data = fread(fopen($image_file, 'r'), filesize($image_file));
	  $base64_image = 'data:' . $image_info['mime'] . ';base64,' . chunk_split(base64_encode($image_data));
	  return $base64_image;
  }
?>